const state={
	visitDialog: false,
	stuId:'',
	stuInfo:{name:'fifi',img:'',parent:'罗小小',linkphone:'18798328117'},
	visitcontent:[
			{
				visitdate:'2019-03-02',
				visitcontent:'报名意向',
				visitresult:'有意向报名',
				merchandiser:'罗小二',
				operator:'罗大大',
				threadstate:'正在跟进',
				nextvisitime:'2019-03-05'
			},
			{
				visitdate:'2019-03-05',
				visitcontent:'报名意向',
				visitresult:'已报名',
				merchandiser:'罗小二',
				operator:'罗大大',
				threadstate:'完成',
				nextvisitime:'2019-03-10'
			}
	],
	threadstate:[
			{name:'线索状态',value:'1'},
			{name:'待跟进',value:'2'},
			{name:'跟进中',value:'3'},
			{name:'已邀约',value:'4'},
			{name:'已试听',value:'5'},
			{name:'已到访',value:'6'},
			{name:'已成交',value:'7'},
	]
	
};
const getters={
	
	isShow(state) {  //方法名随意,主要是来承载变化的stuDialog的值
       return state.visitDialog
    },
    getStuId(state){
    	return state.stuId
    },
    getStuInfo(state){
    	return state.stuInfo
    },
    getVisitcontent(state){
    	return state.visitcontent
    },
    getThreadstate(state){
    	
    	return state.threadstate
    }
};

const mutations = {
	show(state) {   //自定义改变state初始值的方法，这里面的参数除了state之外还可以再传额外的参数(变量或对象);
        state.visitDialog = true;
    },
    hide(state) {  //同上
        state.visitDialog = false;
    },
    setStuId(state,id){    	
    	state.stuId = id;
    }
};

const actions = {
	hidesvisitPanel(context) {  //自定义触发mutations里函数的方法，context与store 实例具有相同方法和属性
        context.commit('hide');
    },
    showvisitPanel(context) {  //同上注释
        context.commit('show');
    },
    setstuId(context,id){   	
    	
    	context.commit('setStuId',id);
    },
};

module.exports = {
	  namespaced:true,//用于在全局引用此文件里的方法时标识这一个的文件名
	  state,
	  getters,
	  actions,
	  mutations
}